/*/////////////////////////////////////////////////////////////////////////////////
/// An
///    ___   ____ ___ _____ ___  ____
///   / _ \ / ___|_ _|_   _/ _ \|  _ \
///  | | | | |  _ | |  | || | | | |_) |
///  | |_| | |_| || |  | || |_| |  _ <
///   \___/ \____|___| |_| \___/|_| \_\
///                              File
///
/// Copyright (c) 2008-2009 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
//
//This program is free software; you can redistribute it and/or modify it under
//the terms of the GNU Lesser General Public License as published by the Free Software
//Foundation; either version 2 of the License, or (at your option) any later
//version.
//
//This program is distributed in the hope that it will be useful, but WITHOUT
//ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
//FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public License along with
//this program; if not, write to the Free Software Foundation, Inc., 59 Temple
//Place - Suite 330, Boston, MA 02111-1307, USA, or go to
//http://www.gnu.org/copyleft/lesser.txt.
////////////////////////////////////////////////////////////////////////////////*/

#pragma once

namespace Ogitors
{

class OgitorExport CVisualHelper
{
public:
    CVisualHelper(CBaseEditor *parent);
    virtual ~CVisualHelper();

    virtual void Show(bool bShow) = 0;
    virtual Ogre::AxisAlignedBox getAABB() = 0;
    inline  Ogre::SceneNode *getNode() {return m_Node;};
    virtual void Destroy() = 0;

protected:
    CBaseEditor     *m_Parent;
    Ogre::SceneNode *m_Node;
    bool             m_Visible;
};

class OgitorExport CEntityVisualHelper: public CVisualHelper
{
public:
    CEntityVisualHelper(CBaseEditor *parent, bool scalesensitive = true);
    virtual ~CEntityVisualHelper();

    void SetModel(Ogre::String model);
    void SetMaterial(Ogre::MaterialPtr material);
    void SetMaterialName(const Ogre::String& matname);
    virtual void Show(bool bShow);
    virtual Ogre::AxisAlignedBox getAABB();
    virtual void Destroy();

    /**
    EDITOROBSERVER OVERRIDES
    **/
    void OnParentsParentChange(Ogre::Any value);
    void OnParentsNodeScaleChange(Ogre::Any value);
    void OnParentPositionChange(Ogre::Any value);
    void OnParentOrientationChange(Ogre::Any value);

protected:
    Ogre::Entity *m_Handle;
    bool          m_isScaleSensitive;
    OgitorsScopedConnection m_Connections[4];
};
}
